<script lang="ts">

import router from "@/router";
import axios from "axios";
import type { AnalyseModel } from "@/model/AnalyseModel";

export default {
  data() {
    const emptyAnalyseList: Array<AnalyseModel> = [];
    return { analyseList: emptyAnalyseList };
  },
  mounted() {
    axios.get("src/assets/config.json")
      .then(response => axios.get(`${response.data.url}loadAnalyse`, { method: "GET" }))
      .then(response => {
        const analyseModelList: Array<AnalyseModel> = response.data;
        analyseModelList.forEach(analyse => this.analyseList.push(analyse));
      })
      .catch(err => console.log(err));
  },
  methods: {
    jumpStockNorm: function(ts_code: string) {
      router.push({ name: "stockNorm", query: { ts_code } });
    }
  }
};

</script>

<template>
  <li v-for="analyse in analyseList" @click="jumpStockNorm(analyse.ts_code)">
    {{ analyse.ts_code }} - {{ analyse.norm }} - {{ analyse.deviate_ratio }} - {{ analyse.trade_date }} -
    {{ analyse.increment_day }} - {{ analyse.remark }}
  </li>
</template>
